<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><s:property value="#application.systemInfor.webName"/>－往期团购</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/tools/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/tags.js"></script>
<script >
var keylis = new Array(${tags});
    $(document).ready(function(){
     
           var sort='<s:property value="sort"/>';
             if(sort!="")
             {
               $("#sort").val(sort);
             }
		      var X = $("#imgKeyword").position().top+3;
		    var Y = $("#imgKeyword").position().left+7;
		    
		    $("#keyword").css({top:X+"px",left:Y+"px"});
			$("#keyword").keyup(function(event){
				   var myEvent = event||window.event;
				   var keyCode = myEvent.keyCode;
				   if(keyCode==13)
				   {
				   	  var keyword=$.trim($("#keyword").val());
					  if(keyword!="")
					  {
					  	window.location.href="groupby!oldGroupbyMoreList.action?currentPage=1&cityId=<s:property value="cityId"/>&date=<s:property value="date"/>&keyword="+$("#keyword").val();
					  }else
					  {
					  	window.location.href="groupby!oldGroupbyMoreList.action?currentPage=1&cityId=<s:property value="cityId"/>&date=<s:property value="date"/>";
					  }
				   }
		
			});
		   });
	function sort()
   {
        var sort =$("#sort").val();
         var keyword='<s:property value="keyword"  escape="false" />';
         var categoryId='<s:property value="categoryId"  escape="false" />';
        if(sort!="")
        {
           var path="";
          if(keyword!="")
          {
          path="&keyword="+keyword;
          }
          if(categoryId!="")
          {
          path="&categoryId="+categoryId;
          }
            window.location.href="groupby!oldGroupbyMoreList.action?currentPage=1&cityId=<s:property value="cityId"/>"+path+"&date=<s:property value="date"/>&sort="+sort;
        }
   } 
   
   function addTop(id,obj)
{
	
	var date =new Date();
	

$.getJSON("groupbyajax/groupby!top.action?times="+date.getTime(),{id:id+",4"},function(data){
		   if(data.success=="nologin")
		   {
		   	  alert("请先登录！");
		   }else
		   {
		   	$(obj).parent().parent().find("td:eq(1)").html(data.success);
		   }
		   
		
	});


}
</script>
</head>

<body>

<div class="container">


<jsp:include page="../head.jsp"/>
<div class="content">
  <div class="lan">
  <ul>
  <li><img src="images/head_01.jpg" id="imgKeyword" /></li>
  <li>
  <select id="sort" onchange="sort()">
         <option value="">搜索方式</option>
         <option value="price,desc">按价格由高到低</option>
         <option value="price,asc">按价格由低到高</option>
         <option value="endDate,desc">按时间由近及远</option>
         <option value="endDate,asc">按时间由远及近</option>
         <option value="discountPercent,desc">按折扣由高到低</option>
         <option value="discountPercent,asc">按折扣由低到高</option>
	</select>
	</li>
</ul></div>
<input type="text" id="keyword" style="position:absolute;width:115px;height:15px;border:0px;background-color:#F2F2F2;" />
<div class="lan2"><ul>
 <li>
							<a href="groupby!oldGroupbyMoreList.action?currentPage=1&cityId=<s:property value="cityId"/>&date=<s:property value="date"/>">全部</a>
			</li>
<s:iterator value="#request.categoryListAll" id="id" >   
		    <li>
							<a href="groupby!oldGroupbyMoreList.action?currentPage=1&cityId=<s:property value="cityId"/>&date=<s:property value="date"/>&categoryId=<s:property value="id"/>"><s:property value="categoryName"/></a>
			</li>
 </s:iterator>
</ul></div>

<div class="wrap">


      <div class="left">
	    
		<div class="lan3"><a  target="_parent"><fmt:parseDate value="${date}" pattern="yyyy-MM-dd" var="date" scope="request"/><fmt:formatDate value="${date}" pattern="yyyy年MM月dd"/></a><span class="ziti_span"></span></div>
		<div class="hh1">
		<input type="hidden" id="url" value="groupby!oldGroupbyMoreList.action?currentPage=1&cityId=${cityId }&date=${date }&keyword="/><!-- 供tags使用 -->
		<s:iterator value="#request.oldGroupbyMoreList" id="id"
							status="status">
							<s:if test="#status.odd">
								<div class="box">
										<div class="box_top"></div>
										<div class="box_con">
											<div class="box_nei">
												<div class="t">
													<span class="tag" id='tags<s:property value="#status.index"/>'>
													</span>
												</div>
												
												<img src='<s:property value="#id[8]"/>' align='middle' class='img' />
												<span style="background-color: #ffffff; font-size: 12px;">现价:<span
													class="teshu"><s:property value="#id[2].substring(0,#id[2].length()-2)"/>元</span>&nbsp;原价:<span class="teshu"><s:property value="#id[3].substring(0,#id[3].length()-2)"/>元</span>&nbsp;折扣:<span
													class="teshu"><s:property value="#id[4]"/></span>&nbsp;节省:<span class="teshu"><s:property value="#id[5].substring(0,#id[5].length()-2)"/>元</span>
												    
												   </span>
												</span>
												<br />
												
												<s:if test="%{#id[1].length()>55}"> 
								                     <span id='t<s:property value="#status.index"/>' title='<s:property value="#id[1]" />' class="teshu2">&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[11]" escape="false" /><s:property value="#id[1].substring(0,55)+'...'" /></span>
											     </s:if> 
											     <s:else>
											        <span id='t<s:property value="#status.index"/>' title='<s:property value="#id[1]" />' class="teshu2">&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[11]" escape="false" /><s:property value="#id[1]" /></span>
											     </s:else>
												
												
												<br />
												<table width="100%" border="0" align="center" cellpadding="0"
													cellspacing="0" class="table">
													<tr>
														<td align="center" valign="middle">
															<a href="javascript:void(0);" onclick="addTop(<s:property value="#id[0]"/>,this);"><img src="images/ding.jpg" align="bottom" /></a>
														</td>
														<td align="center" valign="middle">
															<s:property value="#id[6]"/>人
														</td>
														<td align="center" valign="middle">
															<a href="groupbyCriticism!criticismGroupby.action?groupbyId=<s:property value="#id[0]"/>&currentPage=1&cityId=${cityId}"><img src="images/pinglun.jpg" /></a>
														</td>
														<td align="center" valign="middle">
															<s:property value="#id[7]"/>人
														</td>
														<td align="center" valign="middle">
															<a href="<s:property value="#id[10]"/>" target="_blank"><img src="images/anniu2.jpg" /></a>
														</td>
			
													</tr>
												</table>
											</div>
										</div>
									</div>
							</s:if>
							<s:if test="#status.even">
								<div class="box1">
							       <div class="box_top"></div>
									<div class="box_con">
										<div class="box_nei">
											<div class="t">
												<span class="tag" id='tags<s:property value="#status.index"/>'>
												</span>
											</div>
											<img src="<s:property value="#id[8]"/>" align="middle" class="img" />
											<span style="background-color: #ffffff; font-size: 12px;">现价:<span
												class="teshu"><s:property value="#id[2].substring(0,#id[2].length()-2)"/>元</span>&nbsp;原价:<span class="teshu"><s:property value="#id[3].substring(0,#id[3].length()-2)"/>元</span>&nbsp;折扣:<span
												class="teshu"><s:property value="#id[4]"/></span>&nbsp;节省:<span class="teshu"><s:property value="#id[5].substring(0,#id[5].length()-2)"/>元</span>
												
											</span>
											</span>
											<br />
											<s:if test="%{#id[1].length()>55}"> 
								                     <span id='t<s:property value="#status.index"/>' title='<s:property value="#id[1]" />' class="teshu2">&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[11]" escape="false" /><s:property value="#id[1].substring(0,55)+'...'" /></span>
											     </s:if> 
											     <s:else>
											        <span id='t<s:property value="#status.index"/>' title='<s:property value="#id[1]" />' class="teshu2">&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[11]" escape="false" /><s:property value="#id[1]" /></span>
											     </s:else>
											
											<br />
											<table width="100%" border="0" align="center" cellpadding="0"
												cellspacing="0" class="table">
												<tr>
													<td align="center" valign="middle">
														<a href="javascript:void(0);" onclick="addTop(<s:property value="#id[0]"/>,this);"><img src="images/ding.jpg" align="bottom" /></a>
													</td>
													<td align="center" valign="middle">
														<s:property value="#id[6]"/>人
													</td>
													<td align="center" valign="middle">
														<a href="groupbyCriticism!criticismGroupby.action?groupbyId=<s:property value="#id[0]"/>&currentPage=1&cityId=${cityId}"><img src="images/pinglun.jpg" /></a>
													</td>
													<td align="center" valign="middle">
														<s:property value="#id[7]"/>人
													</td>
													<td align="center" valign="middle">
														<a href="<s:property value="#id[10]"/>" target="_blank"><img src="images/anniu2.jpg" /></a>
													</td>
		
												</tr>
											</table>
										</div>
									</div>
								</div>
							</s:if>
						</s:iterator>


		</div>
		
		
		<div class="clear"></div>
	     <div class="ye">
	         <s:if test="#request.oldGroupbyMoreList.size()!=0">
			                
							<a href="${paramStr}1">第一页</a>&nbsp;&nbsp;<a href="${paramStr}<s:property value="#request.pages.prePage"/>">上一页</a>
							  
							   <s:set name="totalPage" value="#request.pages.totalPage"></s:set>
							   
							   <s:set name="currentPage" value="#request.pages.currentPage"></s:set>
							   <s:if test="#currentPage<=0">
							      <s:set name="currentPage" value="1"></s:set>
							   </s:if>
							   <s:elseif test="#currentPage>#totalPage">
							      <s:set name="currentPage" value="#totalPage"></s:set>
							   </s:elseif>
							   
							   <s:if test="#totalPage%8>0">
							       <s:set name="pageSize" value="#totalPage/8+1"></s:set>
							   </s:if>
							   <s:else>
							       <s:set name="pageSize" value="#totalPage/8"></s:set>
							   </s:else>
							  
							   
							   <s:if test="#currentPage%8>0">
							       <s:set name="cPageSize" value="#currentPage/8+1"></s:set>
							   </s:if>
							   <s:else>
							       <s:set name="cPageSize" value="#currentPage/8"></s:set>
							   </s:else>
							   
							   <s:set name="first" value="8*(#cPageSize-1)"></s:set>
							   <s:if test="#first==0">
							      <s:set name="first" value="1"></s:set>
							   </s:if>
							   <s:set name="last" value="#cPageSize*8"></s:set>
							   <s:if test="#last>#totalPage">
							      <s:set name="last" value="#totalPage"></s:set>
							   </s:if>
				
							     <s:bean name="org.apache.struts2.util.Counter" id="counter"> 
							       <s:param name="first" value="#first"/>
							       <s:param name="last" value="#last" />
							       <s:iterator status="status"> 
							          
							         <s:if test="#currentPage==(#status.index+#first)">
							            &nbsp;&nbsp;<s:a href="%{paramStr}%{#status.index+#first}" cssStyle="background-color:#982987;color:#FFFFFF; padding-right:3px; padding-left:3px;" ><s:property value="#status.index+#first" /></s:a>
							         </s:if>
							         <s:else>
							            &nbsp;&nbsp;<s:a href="%{pageUrl}%{#status.index+#first}" ><s:property value="#status.index+#first" /></s:a>
							         </s:else>
							          
							       </s:iterator> 
							     </s:bean>
							     <s:if test="#last<#totalPage">
							       ......&nbsp;
							     </s:if>
							<a href="${paramStr}<s:property value="#request.pages.nextPage"/>">下一页</a>&nbsp;&nbsp;<a href="${paramStr}<s:property value="#request.pages.totalPage"/>">最后一页</a>
					        </s:if>
	     </div> 	
		
</div>
	  
	  
	  
	  
<div class="right">
      <a href="<s:property value="#application.systemInfor.adImage[13].split(',')[1]"/>"><img src="uploadFile/ad/<s:property value="#application.systemInfor.adImage[13].split(',')[0]"/>" width="307"  height="188" class="tu"/></a>
	
	  
	  <a href="<s:property value="#application.systemInfor.adImage[14].split(',')[1]"/>"><img src="uploadFile/ad/<s:property value="#application.systemInfor.adImage[14].split(',')[0]"/>" class="tu" width="307"  height="188"/></a>
	     <div class="box2">
		      <div class="box2_top"><a  target="_parent">优买排行</a></div>
			  <div class="box2_con">
			    <ul class="bo">
				<s:iterator value="#request.groupbyBefore" id="id" status="status">
								      <s:if test="#status.index==4">
								          <li class="no">
								      </s:if>
								      <s:else>
								           <li >
								      </s:else>
								        
											<div class="pic2">
												<a href="<s:property value="#id.dealUrl"/>" target="_blank"><img src="<s:property value="#id.image"/>" width="67" height="45" align="middle" /></a>
											</div>
											<div class="info2">
											<a href="<s:property value="#id.dealUrl"/>" target="_blank">
												&nbsp;&nbsp;&nbsp;&nbsp;
												<s:if test="%{#id.title.length()>60}"> 
                                                   <s:property value="#id.title.trim().substring(0,60)+'...'" />
											     </s:if> 
											     <s:else>
											        <s:property value="#id.title.trim()" />
											     </s:else>
											     </a>
											</div>
											<div class="clear"></div>
									   </li>
								   </s:iterator>
                </ul>
	   </div>
	 
</div>
		
		<!--------------------------------end box2------------------------------------>
<div class="box2">
		      <div class="box2_top"><a  target="_parent">最新评论</a></div>
			  <div class="box2_con">
			  <ul class="ul2">
			      <s:iterator value="#request.groupbyCriticismList" id="id" status="status">
									   <s:set name="urlContent">user/groupbyCriticism!criticismGroupby.action?groupbyId=<s:property value="#id[7]"/>&currentPage=1&cityId=<s:property value="cityId"/></s:set>
								         
									   <s:if test="#id[6]==2">
					                      <s:set name="url">user/user!singleUserPage.action?currentPage=1&userId=<s:property value="#id[5]"/></s:set>
									   </s:if>
									   <s:elseif test="#id[6]==3">
									      <s:set name="url">user/user!groupbyUserPage.action?currentPage=1&userId=<s:property value="#id[5]"/></s:set>
									   </s:elseif>
									   <s:elseif test="#id[6]==4">
									      <s:set name="url">user/user!brandUserPage.action?currentPage=1&userId=<s:property value="#id[5]"/></s:set>
									   </s:elseif>
								       <li>
										<div class="pic">
										   <a href="<s:property value="url"/>">
											<s:if test="#id[3].equals('')">
					                 			<img src="uploadFile/img.gif" width=60 height=60/>
								            </s:if>
								            <s:else>
								                 <img src="uploadFile/<s:property  value="#id[3]"/>" width=60 height=60/>
								            </s:else>
								            </a>
										</div>
										<div class="info">
											<div class="xin">
												<table width="100%" border="0" cellspacing="0"
													cellpadding="0">
													<tr>
														<td width="65%" align="left" valign="middle">
															&nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[2]"/>:<a href="<s:property value="url"/>" class="ziti"><s:property value="#id[4]"/></a>
														</td>
														
													</tr>

												</table>

											</div>
											<a href="<s:property value="urlContent"/>">
											<s:if test="%{#id[1].length()>50}">
											    &nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[1].substring(0,50)"/>...
											</s:if>
											<s:else>
											    &nbsp;&nbsp;&nbsp;&nbsp;<s:property value="#id[1]"/>
											</s:else>
											</a>
										</div>
										<!--end info-->
										<div class="clear"></div>
									  </li>
									 
								   </s:iterator>
				  
               </ul>

		</div>
		
		
</div>
		
		
		
		<!---------------------end box2-------------------------------------------------------->
		
		
	  </div>
	 
	<div class="clear"></div>
	  
	 
	  
    </div>
	
	  
</div>


<div id="foot"><jsp:include page="../bot.jsp"></jsp:include></div>
<input type="hidden" id="legnth" value='<s:property value="#request.oldGroupbyMoreList.size()"/>'/>

</div>
</body>
</html>
 <script> 
  var legnth=$("#legnth").val();
  
  var tagsId=[];
  for(var i=0;i<legnth;i++)
  {
    tagsId.push("tags"+i+",t"+i);
   
  }
  lastIndexDemo(tagsId);
 </script>
